<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用工统计列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>时间：</label>
                                <input type="text" data-type="month" class="time-input" placeholder="请选择时间" name="month"/>
                            </li>
                            <li>
                                <label>编码：</label>
                                <select name="code" >
                                	<option value="">----所有----</option>
					                <option th:each="dict : ${projectlis}" th:text="${dict.name}" th:value="${dict.orderNo}"></option>
					            </select>
                            </li>
                            <li>
                                <label>假/车：</label>
                                <select name="jc" th:with="type=${@dict.getType('gcgl_jc')}">
                                	<option value="">----所有----</option>
					                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
					            </select>
                            </li>
                            <li>
                                <label>出工人员：</label>
                                <input type="text" name="peopleName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
            	<a class="btn btn-success" onclick="loadShuJu()" shiro:hasPermission="gcgl:kqworks:add">
                    <i class="fa fa-plus"></i> 加载考勤登记数据
                </a>
<!--                 <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="gcgl:ygtj:edit"> -->
<!--                     <i class="fa fa-edit"></i> 修改 -->
<!--                 </a> -->
<!--                 <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="gcgl:ygtj:export"> -->
<!--                     <i class="fa fa-download"></i> 导出 -->
<!--                 </a> -->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('gcgl:ygtj:edit')}]];
        var prefix = ctx + "gcgl/ygtj";

        $(function() {
            var options = {
                url: prefix + "/list",
                updateUrl: prefix + "/edit/{id}",
                exportUrl: prefix + "/export",
                modalName: "用工统计",
                sortName: "id desc",
                sortOrder: "",
                pageSize:50,
                pageList:[10, 25, 50],
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'year',
                    title: '年'
                },
                {
                    field: 'month',
                    title: '月'
                },
                {
                    field: 'day',
                    title: '日'
                },
                {
                    field: 'banz',
                    title: '班组'
                },
                {
                    field: 'daib',
                    title: '带班'
                },
                {
                    field: 'code',
                    title: '编码'
                },
                {
                    field: 'projectName',
                    title: '工程名称',
                    width:400
                },
                {
                    field: 'jc',
                    title: '假/车'
                },
                {
                    field: 'peopleName',
                    title: '出工人员'
                },
                {
                    field: 'descs',
                    title: '工日'
                },
                {
                    field: 'rx',
                    title: '日薪'
                },
                {
                    field: 'jzje',
                    title: '结账金额'
                },
                {
                    field: 'jkrName',
                    title: '结款人姓名',
                    visible: false
                },
                {
                    field: 'jzrq',
                    title: '结账日期',
                    visible: false,
                    width: '90'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        
        //加载数据
        function loadShuJu() {
        	$.modal.loading("数据加载中");
	        $.ajax({
	            url: "/gcgl/ygtj/add",
	            type: "post",
	  			dataType: 'json',
	            success: function (date) {
	            	console.log(date);
	            	$.modal.closeLoading();
	            	$.modal.alertWarning("初始化成功！");
	            },
	            error: function (date) {
	            	$.modal.closeLoading();
	  				$.modal.alertWarning("初始化失败！");
	            }
	        })
        }
    </script>
</body>
</html>